package com.gao.integer;

/**
 * @Author: ShanYuqing
 * @Version: v1.0
 */
public class IntegerTest {
    /*
            需求：已知字符串 String s = "10,50,30,20,30";
            请将该字符串转换为整数并存入数组
            随后将最大值打印在控制台
     */
    public static void main(String[] args) {
        String s = "10,50,30,20,30";
        String[] split = s.split(",");
        int index = 0;
        int [] result = new int[split.length];
        for (int i = 0; i < split.length; i++) {
             int x = Integer.parseInt(split[i]);
             result[index] = x;
             index++;
        }


        int max = result[0];
        for (int i = 1; i < result.length; i++) {
            if(max<result[i]){
                max= result[i];
            }
        }
        System.out.println("最大值"+max);
    }
}
